
* Replication dofile 
* Ms. No. 230793R1: "Do Politicians Listen to Youth Wings? Evidence from an Elite Experiment"
* The Journal of Politics
* 25 September 2024

**************
use "dataset_1.dta", clear
xtset politician_ID issue_ID

* Table 1
tab1 q_contact
tab1 q_help
sum q_indebted
sum competence
sum q_issue_expertise
by issue_ID, sort: sum q_issue_expertise
tab q_youthwing_member

* Table 3
xtreg outcome_variable ib2.treatment external issue_number treatment_number order i.issue_ID, fe cl(party_ID)
xtreg outcome_variable ib0.treatment external issue_number treatment_number order i.issue_ID, fe cl(party_ID)
xtreg outcome_variable ib1.treatment external issue_number treatment_number order i.issue_ID, fe cl(party_ID)
xtreg outcome_variable ib5.treatment external issue_number treatment_number order i.issue_ID, fe cl(party_ID)

* Figure 2
xtreg outcome_variable ib5.treatment##c.competence external issue_number treatment_number order i.issue_ID, fe cl(party_ID)
margins, at(treatment==1 competence=(0(.01)1)) noestimcheck
marginsplot, xdimension(at(competence)) recast(line) plotopts(lcolor(black) lwidth(thick) lpattern(solid)) ///
	recastci(rline) ciopts(lcolor(black) lwidth(med) lpattern(dash)) ///
	ytitle(Predicted distance, size(large) color(black) margin(vsmall)) ///
	ylabel(0(0.5)2, labels labsize(medlarge) labcolor(black)) ///
	xtitle(Assessment of youth wing policy, size(large) color(black)) ///
	xlabel(0(0.2)1, labels labsize(medlarge) labcolor(black)) ///
	addplot(histogram competence, fcolor(gs10%50) lcolor(gs10%50) below yaxis(2) yscale(alt axis(2))) ///	
	title(" ") legend(off)
	
* Figure 3
xtreg outcome_variable ib3.treatment##c.electoral_vulnerability party_list external issue_number treatment_number order i.issue_ID, fe cl(party_ID)
margins, at(treatment=0 electoral_vulnerability=(1(.2)10)) noestimcheck
marginsplot, xdimension(at(electoral_vulnerability)) recast(line) plotopts(lcolor(black) lwidth(thick) lpattern(solid)) ///
	recastci(rline) ciopts(lcolor(black) lwidth(med) lpattern(dash)) ///
	ytitle(Predicted distance, size(large) color(black) margin(vsmall)) ///
	ylabel(, labels labsize(medlarge) labcolor(black)) ///
	xtitle(Politicians' electoral vulnerability, size(large) color(black)) ///
	xlabel(, labels labsize(medlarge) labcolor(black)) ///
	addplot(histogram electoral_vulnerability if electoral_vulnerability <=10, fcolor(gs10%50) lcolor(gs10%50) below yaxis(2) yscale(alt axis(2))) ///	
	title(" ") legend(off)

************
* APPENDIX *
************

*Table A1.1
tab party_ID // Column 1
use "dataset_3.dta", clear // Column 2

*Table A1.2
use "dataset_1.dta", clear
tab region // Column 1
use "dataset_4.dta", clear // Column 2

*Figure A1.1
use "dataset_1.dta", clear
histogram age, by(gender)

* Figure A3.1
use "dataset_2.dta", clear
graph dot (mean) external2 (mean) external1 (mean) external0 (mean) external5, over(party, sort(external2) descending label(labcolor("black"))) linetype(line) by(issue)

* Figure A3.2
use "dataset_1.dta", clear
hist outcome_variable if treatment == 0
hist outcome_variable if treatment == 1
hist outcome_variable if treatment == 2
hist outcome_variable if treatment == 3
hist outcome_variable if treatment == 4
hist outcome_variable if treatment == 5

* Table A3.2
bysort treatment: sum outcome_variable

power twomeans 0.891, sd1(0.694) sd2(0.690) power(0.8) n1(445) n2(357) direction(lower)
power twomeans 0.891, sd1(0.694) sd2(0.694) power(0.8) n1(445) n2(295) direction(lower)
power twomeans 0.891, sd1(0.694) sd2(0.598) power(0.8) n1(445) n2(90) direction(lower) 
power twomeans 0.891, sd1(0.694) sd2(0.688) power(0.8) n1(445) n2(1187) direction(lower) 
power twomeans 0.891, sd1(0.694) sd2(0.677) power(0.8) n1(445) n2(1264) direction(lower) 

power twomeans 0.899, sd1(0.690) sd2(0.694) power(0.8) n1(357) n2(445) direction(lower) 
power twomeans 0.899, sd1(0.690) sd2(0.694) power(0.8) n1(357) n2(295) direction(lower) 
power twomeans 0.899, sd1(0.690) sd2(0.598) power(0.8) n1(357) n2(90) direction(lower) 
power twomeans 0.899, sd1(0.690) sd2(0.688) power(0.8) n1(357) n2(1187) direction(lower)
power twomeans 0.899, sd1(0.690) sd2(0.677) power(0.8) n1(357) n2(1264) direction(lower)

power twomeans 0.952, sd1(0.694) sd2(0.694) power(0.8) n1(295) n2(445) direction(lower) 
power twomeans 0.952, sd1(0.694) sd2(0.690) power(0.8) n1(295) n2(357) direction(lower) 
power twomeans 0.952, sd1(0.694) sd2(0.598) power(0.8) n1(295) n2(90) direction(lower) 
power twomeans 0.952, sd1(0.694) sd2(0.688) power(0.8) n1(295) n2(1187) direction(lower)
power twomeans 0.952, sd1(0.694) sd2(0.677) power(0.8) n1(295) n2(1264) direction(lower)

power twomeans 0.948, sd1(0.598) sd2(0.694) power(0.8) n1(90) n2(445) direction(lower) 
power twomeans 0.948, sd1(0.598) sd2(0.690) power(0.8) n1(90) n2(357) direction(lower) 
power twomeans 0.948, sd1(0.598) sd2(0.952) power(0.8) n1(90) n2(295) direction(lower) 
power twomeans 0.948, sd1(0.598) sd2(0.688) power(0.8) n1(90) n2(1187) direction(lower)
power twomeans 0.948, sd1(0.598) sd2(0.677) power(0.8) n1(90) n2(1264) direction(lower)

power twomeans 0.954, sd1(0.688) sd2(0.694) power(0.8) n1(1187) n2(445) direction(lower)
power twomeans 0.954, sd1(0.688) sd2(0.690) power(0.8) n1(1187) n2(357) direction(lower)
power twomeans 0.954, sd1(0.688) sd2(0.694) power(0.8) n1(1187) n2(295) direction(lower)
power twomeans 0.954, sd1(0.688) sd2(0.598) power(0.8) n1(1187) n2(90) direction(lower) 
power twomeans 0.954, sd1(0.688) sd2(0.677) power(0.8) n1(1187) n2(1264) direction(lower)

power twomeans 0.903, sd1(0.677) sd2(0.694) power(0.8) n1(1264) n2(445) direction(lower) 
power twomeans 0.903, sd1(0.677) sd2(0.690) power(0.8) n1(1264) n2(357) direction(lower) 
power twomeans 0.903, sd1(0.677) sd2(0.694) power(0.8) n1(1264) n2(295) direction(lower) 
power twomeans 0.903, sd1(0.677) sd2(0.598) power(0.8) n1(1264) n2(90) direction(lower) 
power twomeans 0.903, sd1(0.677) sd2(0.688) power(0.8) n1(1264) n2(1187) direction(lower)

* Table A3.3
recode treatment (2=1)(0=2)(1=3)(5=4)(3=5)(4=6) // To get the right order in the rows of the Table. 
label define treat ///
	1 "Youth wing w/ base argument " ///
	2 "Youth wing w/ youth appeal" ///
	3 "Youth wing w/ radical argument" ///
	4 "Youth wing w/ moderate argument" ///
	5 "Mother party w/ base argument" ///
	6 "Control w/o argument", replace
label values treatment treat
tab2 treatment issue_ID

* Table A3.4
tab2 treatment party_ID

* Table A3.5
tab1 q_contact
tab1 q_help
sum q_indebted
sum competence
sum q_issue_expertise
by issue_ID, sort: sum q_issue_expertise
tab q_youthwing_member

*Table A4.1
xtset politician_ID issue_ID
xtreg outcome_variable ib2.treatment external issue_number treatment_number order i.issue_ID, fe cl(party_ID)
xtreg outcome_variable ib2.treatment external issue_number treatment_number order i.issue_ID if issue_ID != 5, fe cl(party_ID)
xtreg outcome_variable ib2.treatment external issue_number treatment_number order i.issue_ID if issue_ID != 6, fe cl(party_ID)
xtreg outcome_variable ib2.treatment external issue_number treatment_number order i.issue_ID if issue_ID != 7, fe cl(party_ID) 
xtreg outcome_variable ib2.treatment external issue_number treatment_number order i.issue_ID if issue_ID != 9, fe cl(party_ID) 
xtreg outcome_variable ib2.treatment external issue_number treatment_number order i.issue_ID if issue_ID != 10, fe cl(party_ID) 
xtreg outcome_variable ib2.treatment external issue_number treatment_number order i.issue_ID if issue_ID != 15, fe cl(party_ID) 
xtreg outcome_variable ib2.treatment external issue_number treatment_number order i.issue_ID if issue_ID != 23, fe cl(party_ID) 
xtreg outcome_variable ib2.treatment external issue_number treatment_number order i.issue_ID if issue_ID != 107, fe cl(party_ID) 
xtreg outcome_variable ib2.treatment external issue_number treatment_number order i.issue_ID if issue_ID != 1308, fe cl(party_ID) 

*Table A4.2
xtreg outcome_variable ib2.treatment external issue_number treatment_number order i.issue_ID, fe cl(party_ID)
xtreg outcome_variable ib2.treatment external issue_number treatment_number order i.issue_ID if party_ID != 110, fe cl(party_ID)  
xtreg outcome_variable ib2.treatment external issue_number treatment_number order i.issue_ID if party_ID != 220, fe cl(party_ID)  
xtreg outcome_variable ib2.treatment external issue_number treatment_number order i.issue_ID if party_ID != 320, fe cl(party_ID)  
xtreg outcome_variable ib2.treatment external issue_number treatment_number order i.issue_ID if party_ID != 410, fe cl(party_ID)  
xtreg outcome_variable ib2.treatment external issue_number treatment_number order i.issue_ID if party_ID != 420, fe cl(party_ID)  
xtreg outcome_variable ib2.treatment external issue_number treatment_number order i.issue_ID if party_ID != 620, fe cl(party_ID)  
xtreg outcome_variable ib2.treatment external issue_number treatment_number order i.issue_ID if party_ID != 710, fe cl(party_ID)  
xtreg outcome_variable ib2.treatment external issue_number treatment_number order i.issue_ID if party_ID != 720, fe cl(party_ID)  

*Table A4.3
xtreg outcome_variable ib2.treatment external issue_number treatment_number order i.issue_ID, fe cl(party_ID)
xtreg outcome_variable ib2.treatment external issue_number treatment_number order i.issue_ID if region != 1, fe cl(party_ID)  
xtreg outcome_variable ib2.treatment external issue_number treatment_number order i.issue_ID if region != 2, fe cl(party_ID)  
xtreg outcome_variable ib2.treatment external issue_number treatment_number order i.issue_ID if region != 3, fe cl(party_ID)  
xtreg outcome_variable ib2.treatment external issue_number treatment_number order i.issue_ID if region != 4, fe cl(party_ID)  
xtreg outcome_variable ib2.treatment external issue_number treatment_number order i.issue_ID if region != 5, fe cl(party_ID) 
	
* Table A5.1
xtreg outcome_variable ib5.treatment##c.competence external issue_number treatment_number order i.issue_ID, fe cl(party_ID)

* Table A6.1
xtreg outcome_variable ib2.treatment##c.electoral_vulnerability party_list external issue_number treatment_number order i.issue_ID, fe cl(party_ID)
xtreg outcome_variable ib0.treatment##c.electoral_vulnerability party_list external issue_number treatment_number order i.issue_ID, fe cl(party_ID)
xtreg outcome_variable ib1.treatment##c.electoral_vulnerability party_list external issue_number treatment_number order i.issue_ID, fe cl(party_ID)
xtreg outcome_variable ib3.treatment##c.electoral_vulnerability party_list external issue_number treatment_number order i.issue_ID, fe cl(party_ID)
xtreg outcome_variable ib4.treatment##c.electoral_vulnerability party_list external issue_number treatment_number order i.issue_ID, fe cl(party_ID)

* Table A8.1
xtreg outcome_variable ib2.treatment##i.issue_ownership external issue_number treatment_number order i.issue_ID, fe cl(party_ID)
xtreg outcome_variable ib0.treatment##i.issue_ownership external issue_number treatment_number order i.issue_ID, fe cl(party_ID)
xtreg outcome_variable ib1.treatment##i.issue_ownership external issue_number treatment_number order i.issue_ID, fe cl(party_ID)
xtreg outcome_variable ib5.treatment##i.issue_ownership external issue_number treatment_number order i.issue_ID, fe cl(party_ID)

* Table A8.2
xtreg outcome_variable ib2.treatment##i.issue_ownership external issue_number treatment_number order i.issue_ID, fe cl(party_ID)
xtreg outcome_variable ib0.treatment##i.issue_ownership external issue_number treatment_number order i.issue_ID, fe cl(party_ID)
xtreg outcome_variable ib1.treatment##i.issue_ownership external issue_number treatment_number order i.issue_ID, fe cl(party_ID)
xtreg outcome_variable ib5.treatment##i.issue_ownership external issue_number treatment_number order i.issue_ID, fe cl(party_ID)

* Table A8.3
xtreg outcome_variable ib2.treatment##ib2.youth_issue external issue_number treatment_number order i.issue_ID, fe cl(party_ID)
xtreg outcome_variable ib0.treatment##ib2.youth_issue external issue_number treatment_number order i.issue_ID, fe cl(party_ID)
xtreg outcome_variable ib1.treatment##ib2.youth_issue external issue_number treatment_number order i.issue_ID, fe cl(party_ID)
xtreg outcome_variable ib5.treatment##ib2.youth_issue external issue_number treatment_number order i.issue_ID, fe cl(party_ID)